from market import app
from market.models import db, Goods, User

with app.app_context():
    db.drop_all()
    db.create_all()

    user_1 = User(username='admin', password_hash='11123523')
    good_1 = Goods(name='Iphone', price=1000)
    good_2 = Goods(name='MacBook', price=2000)
    user_1.items.append(good_1)
    user_1.items.append(good_2)

    db.session.add(user_1)
    db.session.commit()

    print(user_1.items)
    print(good_1.owned)